﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IPagedList<WebMassage.Models.New>>" %>

<%@ Import Namespace="WebMassage.Models" %>
<%@ Import Namespace="WebMassage.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Massage - Tin tức
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <link href="<%= Url.Content("~/Content/CSS/Black/news.css") %>" rel="stylesheet"
        type="text/css" />
    <script src="<%= Url.Content("~/Scripts/news.js") %>" type="text/javascript"></script>
    <ul id="listnews">
        <% foreach (New item in Model)
           {%>
        <li>
            <p class="newstitle">
                <a href="#" title="<%= item.Title %>">
                    <%= item.Title %></a>
                <%=  string.Format("{0:hh:mm dd/MM/yyyy}", item.CreatedDate) %>
            </p>
            <p class="newsthumb">
            </p>
            <div class="newscontent" style="padding:10px;">
                <%= Html.Decode(item.Content) %>
            </div>
        </li>
        <% } %>
    </ul>
    <img id="brg" src="/content/images/Black/br.png" alt="rightn" />
    <script type="text/javascript">
        var numtext = 650;
        $('#listnews li').each(function () {
            var imgthumb = $(this).children(".newscontent").find("img").attr("src");
            if (imgthumb == null) {
                imgthumb = "/Content/Images/Black/noimages.jpg";
            }
            var textthumb = $(this).children(".newscontent").text();
            if (textthumb.length > numtext) {
                textthumb = textthumb.substring(0, numtext) + "...";
            }
            $(this).children(".newsthumb").append("<img src='" + imgthumb + "' alt='" + $(this).children(".newstitle:first-child").text() + "' /><p>" + textthumb + "</p>");
        });
        $('#listnews li div').hide();
    </script>
</asp:Content>
